package com.game.heartbeat;

import com.alibaba.fastjson.JSON;
import com.game.bean.Role;
import com.game.hot.Manager;
import com.game.packet.Packet;
import com.game.util.LogUtil;
import com.nets.util.FilterUtil;

import java.time.Clock;

/**
 * @author sig
 * @since 2016/9/24
 */
public class HeartbeatMg implements HeartbeatI {

    @Override
    public void heartbeat(Role role, Packet req) {
        LogUtil.console.info("Heartbeat time:" +
                Clock.systemDefaultZone().millis());
//        LogUtil.console.info("Hello hotSwap");
        LogUtil.console.info(JSON.toJSONString(role, FilterUtil.filter("accountRole")));
        LogUtil.console.info(JSON.toJSONString(null == role ? null : role.getAccountRole()));
        Packet res = new Packet(req);
        Manager.getPackMg().sendPack(req, res);
    }
}
